#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QStandardItemModel>
#include <QFileDialog>
#include <QTextStream>
#include <QLabel>
#include <QRegExp>
#include <QItemSelectionModel>
#include <QDebug>
#include "myspinboxdelegate.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void initSetting();
    void setModelData(QStandardItemModel *model, QStringList dataList);
    void setStatusBar(QString filePath, QString curRow, QString curColumn, QString curValue);
    void setModelItems(QStandardItemModel *model, QStringList dataList);
    void enableToolButton();

private slots:
    void on_action_load_triggered();

    void on_tableView_doubleClicked(const QModelIndex &index);

    void on_tableView_clicked(const QModelIndex &index);

    void on_TableItemChange(const QModelIndex &cur, const QModelIndex &pre);

    void on_action_add_triggered();

private:
    Ui::MainWindow *ui;
    QStandardItemModel *model;
    QItemSelectionModel *selectModel;

    QLabel *curFileLabel;
    QLabel *curRowLabel;
    QLabel *curColumnLabel;
    QLabel *curValueLabel;

    QStringList parseTableViewColumn(QString header);

    MySpinBoxDelegate mySpinBoxDelegate;

};
#endif // MAINWINDOW_H
